import http from '@/utils/request.js'

export default {
    addToCart: (obj) => {
        return http({
            url: '/api/cart/addCart',
            method: 'post',
            data: obj
        });
    },
    getCart: () => {
        return http({
            url: '/api/cart/getCarts',
            method: 'get'
        });
    },
    deleteProduct: (prod_id) => {
        return http({
            url:` /api/cart/deleteCart/${prod_id}`, //反引号拼接
            method: 'delete',
        });
    },
    increaseCount: (prod_id) => {
        return http({
            url: `/api/cart/increaseCount/${prod_id}`,
            method: 'put'
        });
    },
    decreaseCount: (prod_id) => {
        return http({
            url: `/api/cart/decreaseCount/${prod_id}`,
            method: 'put'
        });
    },
    getCount: () => {
        return http({
            url: '/api/cart/getCount',
            method: 'get'
        });
    },
    getProductCount: (prod_id) => {
        return http({
            url: `/api/cart/getProductCount/${prod_id}`,
            method: 'get'
        });
    },
}